﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace MvcWiki.Test.Model
{
    public class WikiPageFacts
    {
        [Fact]
        public void Create()
        {
            new MvcWiki.Model.WikiPage();
        }

        [Fact]
        public void Has_Id_Property()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            Guid id = (Guid)wikiPage.Id;
        }

        [Fact]
        public void Is_Entity()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            Assert.IsAssignableFrom<MvcWiki.Model.Entity>(wikiPage);
        }

        [Fact]
        public void Equals_To_Self()
        {
            var wikiPage1 = new MvcWiki.Model.WikiPage();

            Assert.True(wikiPage1.Equals(wikiPage1));
        }

        [Fact]
        public void Equals_To_Another()
        {
            var id = Guid.NewGuid();

            var wikiPage1 = new MvcWiki.Model.WikiPage { Id = id };

            var wikiPage2 = new MvcWiki.Model.WikiPage { Id = id };

            Assert.True(wikiPage1.Equals(wikiPage2));
        }

        [Fact]
        public void Not_Equals_To_Another()
        {
            var wikiPage1 = new MvcWiki.Model.WikiPage { Id = Guid.NewGuid() };

            var wikiPage2 = new MvcWiki.Model.WikiPage { Id = Guid.NewGuid() };

            Assert.False(wikiPage1.Equals(wikiPage2));
        }

        [Fact]
        public void Not_Equals_To_Null()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            Assert.False(wikiPage.Equals(null));
        }

        [Fact]
        public void Not_Equals_To_Another_Type()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            var obj = new object();

            Assert.False(wikiPage.Equals(obj));
        }

        [Fact]
        public void Eq_To_Self()
        {
            var wikiPage1 = new MvcWiki.Model.WikiPage();

            var wikiPage2 = wikiPage1;

            Assert.True(wikiPage1 == wikiPage2);
        }

        [Fact]
        public void Eq_To_Another()
        {
            var id = Guid.NewGuid();

            var wikiPage1 = new MvcWiki.Model.WikiPage { Id = id };

            var wikiPage2 = new MvcWiki.Model.WikiPage { Id = id };

            Assert.True(wikiPage1 == wikiPage2);
        }

        [Fact]
        public void Not_Eq_To_Another()
        {
            var wikiPage1 = new MvcWiki.Model.WikiPage { Id = Guid.NewGuid() };

            var wikiPage2 = new MvcWiki.Model.WikiPage { Id = Guid.NewGuid() };

            Assert.True(wikiPage1 != wikiPage2);
        }

        [Fact]
        public void Not_Eq_To_Another_Type()
        {
            var wikiPage1 = new MvcWiki.Model.WikiPage { Id = Guid.NewGuid() };

            var wikiPage2 = new object();

            Assert.True(wikiPage1 != wikiPage2);
        }

        [Fact]
        public void Not_Eq_To_Null()
        {
            var wikiPage1 = new MvcWiki.Model.WikiPage { Id = Guid.NewGuid() };

            MvcWiki.Model.WikiPage wikiPage2 = null;

            Assert.True(wikiPage1 != wikiPage2);
        }

        [Fact]
        public void Has_Revisions_Property()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            IList<MvcWiki.Model.WikiPageRevision> revisions = wikiPage.Revisions;
        }

        [Fact]
        public void Has_Namespace_Property()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            MvcWiki.Model.WikiNamespace wikiNamespace = wikiPage.Namespace;
        }

        [Fact]
        public void Has_Name_Property()
        {
            var wikiPage = new MvcWiki.Model.WikiPage();

            string name = wikiPage.Name;
        }
    }
}
